import {PageContainer, ProColumns, ProTable} from "@ant-design/pro-components";
import {globalLoadTableApi, globalLoadTableApiCode} from "@/services/admin-api/globalApi";
import {useAccess} from "umi";

type Unipush2 = {
  requestId: string;
  pushClientid: string;
  workerId: number
  workerName: string
  title: string;
  content: string;
  msgType: number;
  data: string;
  delFlag: boolean;
  createTime: string;
  createUserId: number;
  createUserName: string;
  updateTime: string;
  updateUserId: number;
  updateUserName: string;
};

export default () => {

  const access = useAccess()

  const columns: ProColumns<Unipush2>[] = [
    // {title: '', valueType: 'indexBorder'},
    {title: 'requestId', dataIndex: 'requestId', valueType: 'text'},
    {title: 'pushClientid', dataIndex: 'pushClientid', valueType: 'text', hideInSearch: true,},
    {title: 'workerId', dataIndex: 'workerId', valueType: 'digit', hideInSearch: true,},
    {title: 'workerName', dataIndex: 'workerName', valueType: 'text', hideInSearch: true,},
    {title: 'title', dataIndex: 'title', valueType: 'text', hideInSearch: true,},
    {title: 'content', dataIndex: 'content', valueType: 'text', hideInSearch: true,},
    {title: 'msgType', dataIndex: 'msgType', valueType: 'text', hideInSearch: true,},
    {title: 'data', dataIndex: 'data', valueType: 'text', hideInSearch: true,},
    {title: '创建时间', dataIndex: 'createTime', valueType: 'dateTime', hideInSearch: true,},
    {title: '创建用户ID', dataIndex: 'createUserId', valueType: 'digit', hideInSearch: true,},
    {title: '创建用户', dataIndex: 'createUserName', valueType: 'text', hideInSearch: true,},
    {title: '更新时间', dataIndex: 'updateTime', valueType: 'dateTime', hideInSearch: true,},
    {title: '更新用户ID', dataIndex: 'updateUserId', valueType: 'digit', hideInSearch: true,},
    {title: '更新用户', dataIndex: 'updateUserName', valueType: 'text', hideInSearch: true,},
  ];

  return <PageContainer header={{title: '', breadcrumb: {},}}>
    <ProTable<Unipush2>
      columns={columns}
      search={{span: 4}}
      request={async (param) => globalLoadTableApiCode('/sys/unipush2/table', 'unipush2:list:search', access, param)} rowKey={(record) => record.requestId}
      columnsState={{
        defaultValue: {
          delFlag: {show: false},
          createUserId: {show: false},
          updateUserId: {show: false}
        }
      }}/>
  </PageContainer>
}
